import qs from 'qs'
import request from '@/utils/request'
// 签名
import _bale from '@/utils/package'

// 获取商品列表
export function getGoodsList(params) {
  return request({
    url: '/mallGoods/getGoodsList',
    method: 'post',
    data: qs.stringify(_bale('getGoodsList', params))
  })
}

// 商品批量上下架
export function setGoodsStockStatus(params) {
  return request({
    url: '/mallGoods/setGoodsStockStatus',
    method: 'post',
    data: qs.stringify(_bale('setGoodsStockStatus', params))
  })
}

// 订单标记缺货、取消缺货
export function setOrderStockStatus(params) {
  return request({
    url: '/orderInfo/setOrderStockStatus',
    method: 'post',
    data: qs.stringify(_bale('setOrderStockStatus', params))
  })
}

// 订单标记缺货、取消缺货
export function setOrderSettleStatus(params) {
  return request({
    url: '/orderInfo/setOrderSettleStatus',
    method: 'post',
    data: qs.stringify(_bale('setOrderSettleStatus', params))
  })
}

// 导入商品库存，接受两个参数file，和params
export function importGoodsStock(file, params) {
  return request({
    timeout: 180000,
    url: '/import/importGoodsStock' + _bale('importGoodsStock', params, true),
    method: 'post',
    data: file // file不做签名
  })
}

// 导入订单发货信息
export function importOrderDeliver(file, params) {
  return request({
    url:
      '/import/importOrderDeliver' + _bale('importOrderDeliver', params, true),
    method: 'post',
    data: file // file不做签名
  })
}

// 下载商品库存
export function exportGoodsStock(params) {
  return request({
    url: 'export/exportGoodsStock' + _bale('exportGoodsStock', params, true),
    method: 'get'
  })
}

// 下载库存模板
export function exportGoodsStockMB(params) {
  return request({
    url:
      'export/exportGoodsStockMB' + _bale('exportGoodsStockMB', params, true),
    method: 'get'
  })
}

// 下载导入订单发货模板
export function exportOrderDeliverMB(params) {
  return request({
    url:
      'export/exportOrderDeliverMB' +
      _bale('exportOrderDeliverMB', params, true),
    method: 'get'
  })
}

// 下载订单信息
export function exportOrderInfo(params) {
  return request({
    url: 'export/exportOrderInfo' + _bale('exportOrderInfo', params, true),
    method: 'get'
  })
}

// 获取订单状态数量
export function getOrderCount(params) {
  return request({
    url: '/orderInfo/getOrderCount',
    method: 'post',
    data: qs.stringify(_bale('getOrderCount', params))
  })
}

// 获取订单状态数量
export function getOrderReturnCount(params) {
  return request({
    url: '/orderReturnInfo/getOrderReturnCount',
    method: 'post',
    data: qs.stringify(_bale('getOrderReturnCount', params))
  })
}

// 获取订单列表
export function getOrderList(params) {
  return request({
    url: '/orderInfo/getOrderList',
    method: 'post',
    data: qs.stringify(_bale('getOrderList', params))
  })
}

// 获取订单列表
export function getOrderReturnList(params) {
  return request({
    url: '/orderReturnInfo/getOrderReturnList',
    method: 'post',
    data: qs.stringify(_bale('getOrderReturnList', params))
  })
}

// 获取订单详情
export function getOrderDetails(params) {
  return request({
    url: '/orderInfo/getOrderDetails',
    method: 'post',
    data: qs.stringify(_bale('getOrderDetails', params))
  })
}

// 获取订单详情
export function getOrderReturnDetails(params) {
  return request({
    url: '/orderReturnInfo/getOrderReturnDetails',
    method: 'post',
    data: qs.stringify(_bale('getOrderReturnDetails', params))
  })
}

// 获取物流公司
export function getLogisticsCompany(params) {
  return request({
    url: '/orderInfo/getLogisticsCompany',
    method: 'post',
    data: qs.stringify(_bale('getLogisticsCompany', params))
  })
}

// 订单确认发货
export function confirmDeliverGoods(params) {
  return request({
    url: '/orderInfo/confirmDeliverGoods',
    method: 'post',
    data: qs.stringify(_bale('confirmDeliverGoods', params))
  })
}

// 供应商确认收货
export function confirmReceiveGoods(params) {
  return request({
    url: '/orderReturnInfo/confirmReceiveGoods',
    method: 'post',
    data: qs.stringify(_bale('confirmReceiveGoods', params))
  })
}

// 供应商确认收货
export function editOrderReceiveAddress(params) {
  return request({
    url: '/orderInfo/editOrderReceiveAddress',
    method: 'post',
    data: qs.stringify(_bale('editOrderReceiveAddress', params))
  })
}

// 获取库存导入记录
export function getStockRecordList(params) {
  return request({
    url: '/mallGoods/getStockRecordList',
    method: 'post',
    data: qs.stringify(_bale('getStockRecordList', params))
  })
}

// 获取库存导入详情记录
export function getStockRecordDetailsList(params) {
  return request({
    url: '/mallGoods/getStockRecordDetailsList',
    method: 'post',
    data: qs.stringify(_bale('getStockRecordDetailsList', params))
  })
}

// 下载库存导入记录
export function exportStockRecord(params) {
  return request({
    url: '/export/exportStockRecord',
    method: 'post',
    data: qs.stringify(_bale('exportStockRecord', params))
  })
}

// 导入库存详情记录
export function importStockRecordDetails(params) {
  return request({
    url: '/mallGoods/importStockRecordDetails',
    method: 'post',
    data: qs.stringify(_bale('importStockRecordDetails', params))
  })
}

// 获取供应商售后地址列表
export function getSupplierReturnAddressList(params) {
  return request({
    url: '/orderReturnInfo/getSupplierReturnAddressList',
    method: 'post',
    data: qs.stringify(_bale('getSupplierReturnAddressList', params))
  })
}

// 添加供应商售后地址
export function addSupplierReturnAddress(params) {
  return request({
    url: '/orderReturnInfo/addSupplierReturnAddress',
    method: 'post',
    data: qs.stringify(_bale('addSupplierReturnAddress', params))
  })
}

// 供应商审核通过
export function checkOrderReturnPass(params) {
  return request({
    url: '/orderReturnInfo/checkOrderReturnPass',
    method: 'post',
    data: qs.stringify(_bale('checkOrderReturnPass', params))
  })
}

// 供应商审核拒绝
export function checkOrderReturnRefuse(params) {
  return request({
    url: '/orderReturnInfo/checkOrderReturnRefuse',
    method: 'post',
    data: qs.stringify(_bale('checkOrderReturnRefuse', params))
  })
}
